//
//  TabViewController.swift
//  jiuzhoudai
//
//  Created by zhaochengfeng on 2025/7/8.
//

import UIKit

class TabViewController: UITabBarController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let jqfxhHomerrVC = JQFXHHomeViewController()
        jqfxhHomerrVC.tabBarItem.title = "借钱"
        
        
        
        let jqfxhMinessVC = JQFXHMineViewController()
        jqfxhMinessVC.tabBarItem.title = "我的"
        
        
        jqfxhHomerrVC.tabBarItem.image = UIImage(named: "jqfxh_jie_unselected")?.withRenderingMode(.alwaysOriginal)
        jqfxhHomerrVC.tabBarItem.selectedImage = UIImage(named: "jqfxh_jie_selected")?.withRenderingMode(.alwaysOriginal)
        
        
        jqfxhMinessVC.tabBarItem.selectedImage = UIImage(named: "jqfxh_me_selected")?.withRenderingMode(.alwaysOriginal)
        jqfxhMinessVC.tabBarItem.image = UIImage(named: "jqfxh_me_unselected")?.withRenderingMode(.alwaysOriginal)

        let jqfxhSelectedrrColor = UIColor.jqfxhTabTexddtRed
        let jqfxhUnselectedqqColor = UIColor.black


        jqfxhMinessVC.tabBarItem.setTitleTextAttributes([.foregroundColor: jqfxhUnselectedqqColor], for: .normal)
        jqfxhMinessVC.tabBarItem.setTitleTextAttributes([.foregroundColor: jqfxhSelectedrrColor], for: .selected)
        
        jqfxhHomerrVC.tabBarItem.setTitleTextAttributes([.foregroundColor: jqfxhUnselectedqqColor], for: .normal)
        jqfxhHomerrVC.tabBarItem.setTitleTextAttributes([.foregroundColor: jqfxhSelectedrrColor], for: .selected)

        // 设置 tabBar 的选中图标颜色
        self.tabBar.tintColor = jqfxhSelectedrrColor // 选中的图标颜色
        self.tabBar.unselectedItemTintColor = jqfxhUnselectedqqColor // 未选中的图标颜色

        
        self.viewControllers = [jqfxhHomerrVC, jqfxhMinessVC]
        tabBar.isTranslucent = false
        
        
        
    }
}
